<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script type="text/javascript" src="jquery.min.js"></script>

    <script>
        //登录
        function login() {
            var email = $("#email").val()
            var password = $("#password").val()
            if (!email) {
                alert("邮箱不能为空")
                return;
            }
            ;
            if (!password) {
                alert("密码不能为空")
                return;
            }
            ;
            $.ajax({
                type: "POST",
                url: "http://www.test.com/api/user/login/" + email + "/" + password,
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                data: {},
                success: function (result) {
                    if (result.statusCode == 200) {
                        window.location.href = "http://www.test.com/static/welcome.html";
                    } else {
                        alert(result.statusText)
                    }
                },
                error: function (result) {
                    alert(result.statusText)
                }
            })
        }
    </script>

</head>
<body>

<center style="margin-top: 200px;">
    <form id="indexform" name="indexForm">
        <table border="0">
            <tr>
                <td>邮箱：</td>
                <td><input type="text" id="email" name="email"></td>
            </tr>
            <tr>
                <td>密码：</td>
                <td><input type="password" id="password" name="password">
                </td>
            </tr>
        </table>
        <br>
        <input type="button" value="登录" style="background-color:#08ff00;width: 150px;" onclick="login()">
        <a href="register.html">注册</a>
    </form>
</center>
</body>
</html>
